#!/usr/bin/env bash
set -e

APP=cargohold

# Remove LSB init script link
rm /etc/init.d/$APP

# Unregister shutdown link
update-rc.d -f $APP remove

# If runit symlink exists for $APP, stop the service and remove the link.
[[ -L /etc/service/$APP ]] && sv down $APP && rm /etc/service/$APP && sleep 5 || exit 0
